ScrollImg(".con1 ul",".con1 ul li",2,-156,1,1);
var scroll_t=0;
function ScrollImg(tag_ul,tag_name,num,scroll_width,iscircle,isactive) {

    this.tag_ul=tag_ul;//要轮播的ul
    this.tag_name=tag_name;//轮播的ul li
    this.scroll_num=num;//轮播前默认显示个数
    this.scroll_width=scroll_width;//轮播时的宽度变化

    this.scroll_start_index=0;//开始索引
    this.scroll_end_index=this.scroll_num-1;//结束索引
    this.scroll_cur_index=1;//当前索引
    this.isactive=isactive;
    if(this.isactive==1)
    {
        $(tag_name).eq(1).addClass("active").siblings().removeClass("active");
    }
}
function Scroll_show(scroll_c_cat) {
    var len=$(this.tag_name).length;
    if(scroll_c_cat==1||scroll_c_cat==2)
    {
        if (scroll_c_cat == 2) {//左边
            if (this.scroll_start_index == 0) {
                Scroll_IsEnd(true,2);//滚动结束执行按钮突出显示
                return false;
            }
            else {
                this.scroll_start_index--;
                this.scroll_end_index--;
            }
        }
        else if (scroll_c_cat == 1)//右边
        {
            if(this.scroll_end_index==len-1)
            {
                Scroll_IsEnd(true,1);//滚动结束执行按钮突出显示
                return false;
            }
            else
            {
                this.scroll_start_index++;
                this.scroll_end_index++;
            }
        }
        this.scroll_cur_index=this.scroll_start_index+1;
        $(this.tag_ul).animate({'margin-left': this.scroll_width * scroll_start_index}, 500);
        if(this.isactive==1) {
            $(this.tag_name).eq(this.scroll_cur_index).addClass("active").siblings().removeClass("active");
        }
    }
}
scroll_t=window.setInterval("Scroll_show(0)",3000);


//左右滚动到头执行
function Scroll_IsEnd(isend,drect) {
    if(isend){
        if(drect==1){
            $("input[id='prompt-show-font']").val("没有更多图片了")
            alertBox()
        }
        else if(drect==2){
            $("input[id='prompt-show-font']").val("已经到第一页了")
            alertBox()
        }
    }
}
function alertBox() {
    $("#position-box").removeClass('hide')
    $("#prompt-box").removeClass('hide')
    $(".button-ok").click(function () {
        $("#position-box").addClass('hide')
        $("#prompt-box").addClass('hide')
    })
}
$(".left").click(function () {
    window.clearInterval(scroll_t);
    Scroll_show(2);
});
$(".right").click(function () {
    window.clearInterval(scroll_t);
    Scroll_show(1);
});
$(".left").mouseleave(function () {
    window.clearInterval(scroll_t);
    scroll_t=window.setInterval("Scroll_show(0)",3000);
});
$(".right").mouseleave(function () {
    window.clearInterval(scroll_t);
    scroll_t=window.setInterval("Scroll_show(0)",3000);
});